function [F_diff] = Steady_set(vv_guess,varargin)  

% ===== Initial Variable Construction =====

Par = varargin{1};
Step = varargin{2};
rr_A = varargin{3}(1);
rr_B = varargin{3}(2);

Trans_innov = Step{2};
Trans_fail = Step{3};
Trans_exo  = Step{4};
prft_fnc_A = Step{5}(:,1);
prft_fnc_B = Step{5}(:,2);
          
Param = structvars(Par);
for ctr0 = 1:size(Param,1); eval(Param(ctr0,:)); end;

vv = exp(vv_guess);

% ===== Value Functions  and R&D decisions =====
    
vv_iA = vv(1:length(vv)/2);
vv_iB = vv(1*length(vv)/2+1:2*length(vv)/2);

xx_iA = ((Trans_innov'*vv_iA-...
        vv_iA)/(alfa_A*(1-tau_A))).^(1/(gama_A-1));
xx_iB = ((Trans_innov'*vv_iB-...
        vv_iB)/(alfa_B*(1-tau_B))).^(1/(gama_B-1));

xx_eA = ((Trans_innov'*vv_iA...
            -0)/alfa_eA).^(1/(gama_eA-1));
xx_eB = ((Trans_innov'*vv_iB...
            -0)/alfa_eB).^(1/(gama_eB-1));
        
% ===== Difference Function =====
        

F_iA = prft_fnc_A-(1-tau_A)*alfa_A.*xx_iA.^gama_A/gama_A+...
       xx_iA.*(Trans_innov'*vv_iA-...
       vv_iA)-xx_eA.*vv_iA+...
       flip(xx_eB+xx_iB).*(Trans_fail*vv_iA-vv_iA)+...
       dlt*Trans_exo*vv_iA;
    
F_iB = prft_fnc_B-(1-tau_B)*alfa_B.*xx_iB.^gama_B/gama_B+...
       xx_iB.*(Trans_innov'*vv_iB-...
       vv_iB)-xx_eB.*vv_iB+...
       flip(xx_eA+xx_iA).*(Trans_fail*vv_iB-vv_iB)+...
       dlt*Trans_exo*vv_iB;
        
        
F_diff = kron(diag([rr_A rr_B]),eye(length(vv)/2))*vv-[F_iA; F_iB];
          














